# -*- coding: utf-8 -*-
"""
Created on Tue Jul 14 17:19:16 2020

@author: Administrator
"""


from fvcore.common.file_io import PathManager
#from drawbox import path_annotation






#path_annotation=r'C:/Users/Administrator/Downloads/haikang/ava/annotations/ava_train_v2.2.csv'
FPS = 30
AVA_VALID_FRAMES = range(902, 1799)

 
def load_box_by_name(path_annotation):
    
    filename=path_annotation
    all_boxes={}
    with PathManager.open(filename,'r') as f:
        for line in f:
            row = line.strip().split(',')
            
            video_name=row[0]
            frame_sec=int(row[1])
            item=list(map(float, row[2:])) #x1,y1,x2,y2,label,score
            if video_name not in all_boxes:
                all_boxes[video_name]={}
                for sec in AVA_VALID_FRAMES:
                    all_boxes[video_name][sec]=[]
            
            all_boxes[video_name][frame_sec].append(item)
    return all_boxes



    